<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>简单的图</title>
    <script type="text/javascript" src="../../frame/echarts/echarts.min.js"></script>
    <style>
        div{
            display: inline-block;
        }
    </style>
</head>
<body>
<div id="bar" style="width: 600px;height:400px;"></div>
<div id="line" style="width: 600px;height:400px;"></div>
<div id="pie" style="width: 600px;height:400px;"></div>

<script>
    bar();
    line();
    pie();
    function bar() {
        var myChart = echarts.init(document.getElementById("bar"));
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: 'ECharts 矩形图'
            },
            tooltip: {},
            legend: {
                data:['销量']
            },
            xAxis: {
                data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20]
            }]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    }
    function line() {
        var myChart = echarts.init(document.getElementById("line"));
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: 'ECharts 线形图'
            },
            tooltip: {},
            legend: {
                data:['销量']
            },
            xAxis: {
                data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'line',
                data: [5, 20, 36, 10, 10, 20]
            }]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    }
    function pie() {
        var myChart = echarts.init(document.getElementById("pie"));
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: 'ECharts 饼图'
            },
            series : [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius: '55%',
                    data:[
                        {value:235, name:'视频广告'},
                        {value:274, name:'联盟广告'},
                        {value:310, name:'邮件营销'},
                        {value:335, name:'直接访问'},
                        {value:400, name:'搜索引擎'}
                    ]
                }
            ]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    }
</script>
</body>
</html>